package cn.jeefast.modules.platform.controller;


import cn.jeefast.common.entity.MbDialysisWay;
import cn.jeefast.common.utils.R;
import cn.jeefast.modules.platform.service.MbDialysisWay1Service;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import cn.jeefast.common.base.BaseController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author theodo
 * @since 2020-01-06
 */
@RestController
@RequestMapping("/mbDialysisWay")
@CrossOrigin
public class MbDialysisWay1Controller extends BaseController {
    @Autowired
    private MbDialysisWay1Service mbDialysisWay1Service;

    @RequestMapping("/list")
    public R list(Long projId){
        EntityWrapper ew = new EntityWrapper();
        ew.eq("proj_id",projId);
        return R.ok().put("data",mbDialysisWay1Service.selectList(ew));
    }

    @RequestMapping("/delete")
    public R delete(Long id){
        mbDialysisWay1Service.deleteById(id);
        return R.ok();
    }

    @RequestMapping("/addOrSave")
    public R addOrSave(MbDialysisWay mbDialysisWay){
        if(mbDialysisWay.getDwId()==null){
            mbDialysisWay1Service.insert(mbDialysisWay);
        }else{
            mbDialysisWay1Service.updateById(mbDialysisWay);
        }
        return R.ok();
    }
}
